package com.hunters.web.wechat.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @program: web-wechat
 * @description:
 * @author: 李二
 * @create: 2018/09/05 17:02
 **/
@AllArgsConstructor
@Getter
public enum RetCode {

    NORMAL(0, "正常"),
    LOGIN_OTHERWISE(1101, "其它地方登陆"),
    MOBILE_LOGIN_OUT(1102, "移动端退出"),
    UNKNOWN(9999, "未知");

    private int  code;
    private String type;

    public static RetCode parse(int code) {
        switch (code) {
            case 0:
                return NORMAL;
            case 1102:
                return MOBILE_LOGIN_OUT;
            case 1101:
                return LOGIN_OTHERWISE;
            default:
                return UNKNOWN;
        }
    }
}
